package pl.edu.agh.jemo.conf.types;

import java.util.ArrayList;
import java.util.List;

import pl.edu.agh.jemo.evolution.objfunc.ClassicObjectiveFunction;
import pl.edu.agh.jemo.evolution.objfunc.CrowdingObjectiveFunction;
import pl.edu.agh.jemo.evolution.objfunc.impl.FitnessSharingObjectiveFunction;
import pl.edu.agh.jemo.evolution.objfunc.impl.MichalewiczObjFunc;
import pl.edu.agh.jemo.evolution.objfunc.impl.PopulationCentroidObjectiveFunction;
import pl.edu.agh.jemo.evolution.objfunc.impl.RastriginObjFunc;
import pl.edu.agh.jemo.evolution.objfunc.impl.Simple2DObjFunc;

/**
 * Class dedicated to list all available Objective functions.
 * It is used by user interface, in order to help user choosing an objective functions to be be solved by chosen algorithm
 * 
 * @author Marcin.Zbijowski
 *
 */
public class ObjectiveFunctionTypesHandler {
	
	/**
	 * Returns collection of all available classic objective functions in jemo.
	 * Returned object is java.util.List, containing references to classes being extension of ClassicObjectiveFunction class.
	 * Classes listed here are real problems to be solved.
	 * This method should be updated when adding new objective functions.
	 * 
	 * @return List of objects representing classes of available classic objective functions
	 */
	public static List<PrintableType<? extends ClassicObjectiveFunction>> getClassicObjectiveFunctionTypes() {
		List<PrintableType<? extends ClassicObjectiveFunction>> classes = new ArrayList<PrintableType<? extends ClassicObjectiveFunction>>();
		classes.add(new PrintableType<MichalewiczObjFunc>(MichalewiczObjFunc.class, "Michalewicz"));
		classes.add(new PrintableType<RastriginObjFunc>(RastriginObjFunc.class, "Rastrigin"));
		classes.add(new PrintableType<Simple2DObjFunc>(Simple2DObjFunc.class, "Simple 2D"));
		return classes;
	}

	/**
	 * Returns collection of all available crowding objective functions in jemo.
	 * Returned object is java.util.List, containing references to classes being extension of CrowdingObjectiveFunction class.
	 * Classes listed here are rather methods assuring population spread, then real problems to be solved.
	 * This method should be updated when adding new objective functions.
	 * 
	 * @return List of objects representing classes of available crowding objective functions
	 */
	public static List<PrintableType<? extends CrowdingObjectiveFunction>> getCrowdingObjectiveFunctionTypes() {
		List<PrintableType<? extends CrowdingObjectiveFunction>> classes = new ArrayList<PrintableType<? extends CrowdingObjectiveFunction>>();
		classes.add(new PrintableType<FitnessSharingObjectiveFunction>(FitnessSharingObjectiveFunction.class, "Fitness sharing"));
		classes.add(new PrintableType<PopulationCentroidObjectiveFunction>(PopulationCentroidObjectiveFunction.class, "Population centroid"));
		return classes;
	}

}
